package main

import (
	"fmt"
)

func main() {
	//局部变量
	//浮点类型, 符号位+指数位+尾数位(会存在精度损失)
	var num1 float32 = 3.14
	fmt.Println(num1)

	//314 * 10^-2
	var num2 float32 = -314e-2
	fmt.Println(num2)

	var num3 float32 = 314e-2
	fmt.Println(num3)

	var num4 float32 = 314e+2
	fmt.Println(num4)

	var num5 float32 = 314e+2
	fmt.Println(num5)

	fmt.Println("-------- -------- -------- -------- --------")

	//浮点数可能会有精度损失,所以通常情况下,建议使用 float64
	var num6 float32 = 256.000000916
	fmt.Println(num6)

	var num7 float64 = 256.000000916
	fmt.Println(num7)

	//golang中默认的浮点类型为: float64
	var num8 = 3.17
	fmt.Printf("num8的类型是: %T", num8)
	fmt.Println()
	fmt.Println(num8)

}
